package com.xiaotao.learn.reflect;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

enum EA {
    WOW
}

public class T2 {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException, InstantiationException {
        System.out.println(EA.WOW);
        System.out.println(getUnsafe().allocateInstance(EA.WOW.getClass()));
    }
    private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException {
        Field field = Unsafe.class.getDeclaredField("theUnsafe");
        field.setAccessible(true);
        return (Unsafe)field.get(Unsafe.class);
    }
}
